var app = getApp()
var util = require('../../../utils/util.js')
Page({

  /**
   * 页面的初始数据
   */
  data: {
      publicNum:0,
      updateNum:0,
      releaseNum:0,
      summaryNum:0
  },

    /**
     * 生命周期函数--监听页面加载
     * */
    onLoad: function (options) {
        let that = this
        let header;
        header = {
            'Cookie': wx.getStorageSync("sessionid"), //读取cookie
            'content-type': 'application/x-www-form-urlencoded'
        };
        let params={"taskDefineKeys":["usertask1","usertask4","usertask5","usertask8"],"processDefineKey":"emgFlow1"};
        this.setData({
            publicNum:0,
            updateNum:0,
            releaseNum:0,
            summaryNum:0
        });
        wx.request({
            url: app.globalData.baseUrl + '/safe/wechat/taskTypeCount',
            header: header,
            method: "POST",
            data: params,
            success(res) {
               if(res.data.data){
                   that.setData({
                       publicNum:res.data.data["usertask1"],
                       updateNum:res.data.data["usertask5"],
                       releaseNum:res.data.data["usertask4"],
                       summaryNum:res.data.data["usertask8"]
                   });
               }
            },

        })
    },
    onClickLeft:function () {
        wx.redirectTo({
            url: '/pages/index/index'
        })
    },
    routerClick:function (e) {
        wx.redirectTo({
            url: '/pages/emergency/emerTaskList/emerTaskList?taskDefineKey=' + e.currentTarget.dataset.taskDefineKey
        })
    }

})